Commit Diff


commit - 62ba1098c93f7ce3231e14cb9a2ede771ae096ba
commit + c0bb37282f6051d91e6628b4e901c46ac481a57f
blob - 9b8de9c677aaaf80de894c8d9f7f9038b2a5148c
blob + 0a163b47d7b39e48e6b517fa7dbe5a04c045574d
--- README.md
+++ README.md
@@ -20,6 +20,9 @@ external_rel
 Вставляет ссылку с разрешённым назначением ссылки.
 Для абсолютных ссылок указывает rel из настроек сайта или значение по умолчанию `noopener noreferrer external`.
 
+### render-blockquote
+[Вставляет](https://gohugo.io/render-hooks/blockquotes/) блок цитаты с указанием источника и заголовка, а также блок alert.
+
 ## Шаблоны
 ### baseof
 Базовый шаблон, включающий индексирование Pagefind только для main тега.
blob - /dev/null
blob + 9c664604a0bfa7cd41fc63b3b0f9f1bbebc84556 (mode 644)
--- /dev/null
+++ layouts/_markup/render-blockquote.html
@@ -0,0 +1,35 @@
+{{- $emojis := dict
+  "caution" ":exclamation:"
+  "important" ":information_source:"
+  "note" ":information_source:"
+  "tip" ":bulb:"
+  "warning" ":information_source:"
+-}}
+{{- if eq .Type "alert" -}}
+  <blockquote class="alert alert-{{ .AlertType }}">
+    <p class="alert-heading">
+      {{ transform.Emojify (index $emojis .AlertType) }}
+      {{- with .AlertTitle }}
+        {{ . }}
+      {{- else }}
+        {{ or (i18n .AlertType) (title .AlertType) }}
+      {{- end }}
+    </p>
+    {{ .Text }}
+  </blockquote>
+{{- else }}
+  {{- if .Attributes.caption }}
+  <figure>
+  {{- end }}
+    <blockquote{{ with .Attributes.cite }} cite="{{ . }}"{{ end }}>
+      {{ .Text }}
+    </blockquote>
+    {{ with .Attributes.caption }}
+      <figcaption class="blockquote-caption">
+        {{ . | safeHTML }}
+      </figcaption>
+    {{ end }}
+  {{- if .Attributes.caption }}
+  </figure>
+  {{- end }}
+{{- end }}
blob - /dev/null
blob + e1daf03fc28bf6621fa5155126887f8e8d616ab5 (mode 644)
--- /dev/null
+++ i18n/ru.toml
@@ -0,0 +1,5 @@
+caution = 'Осторожно'
+important = 'Важно'
+note = 'Примечание'
+tip = 'Совет'
+warning = 'Предупреждение'